package com.gimi.cloud.jimi.dao.dao.sys;


import com.gimi.cloud.jimi.dao.common.SqlProvider;
import com.gimi.cloud.jimi.dao.myMapper.MyMapper;
import com.gimi.cloud.jimi.dto.sys.SysConfigDTO;
import com.gimi.cloud.jimi.entity.sys.SysConfigEntity;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

@Mapper
public interface SysConfigDao extends MyMapper<SysConfigEntity> {
	
	@Select("SELECT cf_value FROM sys_config WHERE cf_key = #{cfKey}")
	String getValueByKey(@Param(value = "cfKey") String string);

	@Select("SELECT * FROM sys_config WHERE cf_name like '%${cfName}%'")
	List<SysConfigDTO> getConfigByCfname(@Param(value = "cfName") String cfName);

	@Select("SELECT * FROM sys_config WHERE cf_key like '%${cfKey}%'")
	List<SysConfigDTO> getConfigByCfkey(@Param(value = "cfKey") String cfKey);

	@Select("SELECT * FROM sys_config")
	List<SysConfigDTO> getConfigList();

	@Select("SELECT cf_value FROM sys_config WHERE cf_key = #{cfKey}")
	String getConfigByKey(@Param(value = "cfKey") String string);

	@SelectProvider(method="sql",type=SqlProvider.class)
	List<SysConfigEntity> findBypageList(String sql);

	@Select("SELECT cf_id,cf_key,cf_value,cf_status,is_delete FROM sys_config WHERE cf_status = 'normal' AND is_delete = 0;")
	List<SysConfigDTO> getUseableConfigList();
}